package models

import (
	"github.com/goravel/framework/database/orm"
)

type LoginLog struct {
	orm.Model
	ActionTime      string         `gorm:"column:action_time;type:datetime(3);not null;comment:'操作时间'" json:"action_time"`
	UserName        string         `gorm:"column:user_name;type:varchar(255);not null;comment:'用户名'" json:"user_name"`
	UserId          string         `gorm:"column:user_id;type:varchar(255);not null;comment:'用户id'" json:"user_id"`
	StreamId        string         `gorm:"column:stream_id;type:varchar(255);not null;comment:'stream账号id'" json:"stream_id"`
	LoginType       string         `gorm:"column:login_type;type:varchar(255);not null;comment:'登录类型 登录 登出'" json:"login_type"`
	Ip              string         `gorm:"column:ip;type:varchar(255);not null;comment:'ip'" json:"ip"`
	LoginArea       string         `gorm:"column:login_area;type:varchar(255);not null;comment:'登录地区'" json:"login_area"`
	LoginPosition   string         `gorm:"column:login_position;type:varchar(255);not null;comment:'登录位置'" json:"login_position"`
	OriginalText    string         `gorm:"column:original_text;type:varchar(255);not null;comment:'原文'" json:"original_text"`
	ConfigurationID int            `gorm:"column:configuration_id;type:int;null" form:"configuration_id" json:"configuration_id"`
	Configuration   *Configuration `gorm:"foreignkey:ConfigurationID" form:"-" json:"-"`
}

func (*LoginLog) TableName() string {
	return "loginlogs"
}
